package com.hbx.constant;

import lombok.Getter;
import lombok.Setter;

/*
 * @Author:hbx
 * 
 * 用户类型枚举
 * */
public enum UserTypeEnum {
    SUPER_ADMIN(1,"超级管理员"),
    ADMIN(2,"管理员"),
    USER(3,"用户"),
    ;
    @Setter
    @Getter
    private Integer code;
    @Setter
    @Getter
    private String type;

    UserTypeEnum(Integer code, String type) {
        this.code = code;
        this.type = type;
    }

    public static String getType(Integer code){
        if (code == null){
            return null;
        }
        for (UserTypeEnum typeEnum : UserTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)){
                return typeEnum.getType();
            }
        }

        return null;
    }
}
